<template>
  <div class="wifi">
    <div class="wifi-info">
        <div class="wifi-pic">
            <img class="wifi-img" :src="icon">
            <div>{{name}}</div>
        </div>
        <div class="wifi-comment">{{wifiName}}</div>
    </div>
    <van-button class="wifi-btn" @click="link" :loading="loading" type="primary"  size="large">{{btn_text}}</van-button>
    <div class="wifi-tip">{{wifiTip}}</div>
  </div>
</template>
<script>
export default {
  name: 'wifi',
  comments: 'wifi',
  data () {
    return {
      name: 'Lady健身女王',
      icon: './static/images/icon1.jpg',
      wifiName: 'Lady健身女王Wi-Fi',
      wifiTip: '使用手机验证方式连接',
      loading: false,
      btn_text: '微信连Wi-Fi',
      macAddress: ''
    }
  },
  created () {
    document.title = 'Wi-Fi连接'
    this.getMac()
  },
  methods: {
    // 连接Wi-Fi
    link: function () {
      this.loading = true
      this.$axios.post('/wechat/wifi/signature').then(response => {
        console.log(response.data)
        Wechat_GotoRedirect(response.data.appId, response.data.extend, response.data.timestamp, response.data.sign, response.data.shopId, response.data.authUrl, response.data.mac, response.data.ssid)
      }).catch(error => {
        console.log(error)
      })
    },
    getMac: function () {
      // debugger
    }
  }
}
</script>
<style lang="postcss" scoped>
.wifi-info{
    margin-top: 20%;
}
.wifi-img{
    width: 50px;
    height: 50px;
}
.wifi-success{
    font-size: 4rem;
    color: #06bf04;
}
.wifi-comment,.wifi-tip{
    font-size: 0.5rem;
    color: #999;
    margin-top: 5px;
}
.wifi-btn{
    width: 60%;
    margin-top: 40px;
}
</style>
